var Koa = require('koa');
// var Router = require('koa-router');
var cors = require('koa2-cors');
const koaBody   = require('koa-body');

const user = require('./router/user').user;

var app = new Koa();

app.use(async(ctx,next) => {
    console.time('req');
    console.log('request: ', ctx.originalUrl);
    await next();
    console.timeEnd('req');
});

app.use(koaBody());

app.use(cors());

app
    .use(user.routes());
    // .use(router.allowedMethods());

    app.listen(3000);